﻿namespace AnyOffice.DAL
{
    using Microsoft.ApplicationBlocks.Data;
    using System;
    using System.Data;
    using System.Data.SqlClient;

    public class AssetPrcsPropDao
    {
        public DataTable SelectAll(SqlConnection conn)
        {
            string commandText = "SELECT [PrcsId], [PrcsClass], [PrcsDesc], [PrcsLongDesc] FROM [dbo].[Asset_PrcsProp]";
            DataSet set = SqlHelper.ExecuteDataset(conn, CommandType.Text, commandText);
            set.Tables[0].TableName = "Asset_PrcsProp";
            return set.Tables[0];
        }

        public DataTable SelectByPrcsId(SqlConnection conn, int prcsId)
        {
            string commandText = "SELECT [PrcsId], [PrcsClass], [PrcsDesc], [PrcsLongDesc] FROM [dbo].[Asset_PrcsProp] WHERE [PrcsId] = @PrcsId";
            SqlParameter[] commandParameters = new SqlParameter[] { new SqlParameter("@PrcsId", SqlDbType.Int) };
            commandParameters[0].Value = prcsId;
            DataSet set = SqlHelper.ExecuteDataset(conn, CommandType.Text, commandText, commandParameters);
            set.Tables[0].TableName = "Asset_PrcsProp";
            return set.Tables[0];
        }
    }
}

